package org.aokey.springdemo2;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
@RestController
public class UserInfo {
    @RequestMapping("A1")
    public String A1(@RequestParam List<Integer> list){
        return "接收参数："+list;
    }
    @RequestMapping("A2")
    public String A2(String str){
        return str;
    }
    @RequestMapping("A3")
    public String A3(@RequestBody Animals animals){
        System.out.println(animals.getColor());
        animals.color="彩虹色";
        return animals.toString();
    }
    @RequestMapping("A4/{id}/{age}")
    public String A4(@PathVariable(value ="id" ,required = false) Integer idcard,@PathVariable(required = false) Integer age) {
        return "获取id: "+idcard+",age: "+age;
    }
    @RequestMapping("A5")
    public String A5(MultipartFile file) {
        System.out.println(file.getOriginalFilename());
        return "文件获取成功";
    }
}
